define(['app'], function(app) {
    'use strict';
    //实例化方法
    var factory = function (Http) {
        /**
         * 一键切换数据获取方式
         * @param {Object} result
         */
        function get_data_transferlist(result) {
            if (false) {
                result = '{"success":true,"msg":"","result":{"info":[{"info_id":"001","goods_id":"001","goods_name":"剪刀","store_id":"001","store_name":"上海五金商店","image":"img/upload/pro-img01.jpg","price":"500.55","region_id":"001","region_name":"北京","contact_name":"张三","contact_way":"1897739888","create_time":"2016-9-9 15:20:50"},{"info_id":"002","goods_id":"002","goods_name":"石头","store_id":"002","store_name":"上海五金商店2","image":"img/upload/pro-img01.jpg","price":"100.55","region_id":"002","region_name":"桂林","contact_name":"张四","contact_way":"1897739999","create_time":"2016-9-9 15:20:50"}]}}';
                return JSON.parse(result);
            }
            else {
                return result;
            }
        }

        //返回信息
        return {
            //经营转让
            getlist: function (price,region_id, key, order, nPage, pagelimit, callback,calldone) {
                Http.post({
                    method: 'info.transfer.getlist',
                    price:price,
                    region_id: region_id,
                    key: key,
                    order: order,
                    nPage: nPage,
                    pagelimit: pagelimit

                }, function (result) {
                    //请求成功
                    if (callback) {
                        callback(get_data_transferlist(result).result);
                    }
                }, function (e) {
                    //请求异常
                }, function () {
                	if(calldone)
						calldone();
                });
            }
      
      
        };
    }
    factory.$inject = ['Http'];
    return app.registerService("Transfer", factory);
});